package com.tssm.core.util;

import java.util.Date;

public class TimesUtil extends FormatUtil {
	/**
	 * 
	 * 
	 * @方法说明:取得给定日期的年份
	 * @param formatTime
	 * @return
	 * @作者:徐龙
	 * @日期:2011-5-17
	 */
	public static int getYear(String formatTime) {
		return Integer.parseInt(FORMAT_FOUR.format(FORMAT_TWO
				.format(formatTime)));
	}

	/**
	 * 
	 * 
	 * @方法说明: 取得给定日期的月份
	 * @param formatTime
	 * @return
	 * @作者:徐龙
	 * @日期:2011-5-17
	 */
	public static int getMonth(String formatTime) {
		return Integer.parseInt(FORMAT_FIVE.format(FORMAT_TWO
				.format(formatTime)));
	}


	/**
	 * 
	 * 
	 * @方法说明:得到两个时间（time1-time2）的差
	 * @param time1
	 * @param time2
	 * @return
	 * @作者:徐龙
	 * @日期:2011-5-17
	 */
	public static int getcha(Date time1, Date time2) {
		int t = 0;
		long oltime = time1.getTime();	
		long nltime = time2.getTime();
		t = (int) ((oltime - nltime) / (24 * 3600 * 1000L));
		return t;
	}
}
